﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using InteControlSys.ViewModel;

namespace InteControlSys.Template
{
    public class TrainTemplateSelector:DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            DataTemplate template = null;
            FrameworkElement element = container as FrameworkElement;
            if (item is TrainArriveViewModel)
            {
                template = element.FindResource("TrainArrive") as DataTemplate;
            }
            else if (item is TrainArriveHisViewModel)
            {
                template = element.FindResource("TrainArriveHis") as DataTemplate;
            }
            else if (item is TrainBatchViewModel)
            {
                template = element.FindResource("TrainBatch") as DataTemplate;
            }
            else if (item is TrainBatchHisViewModel)
            {
                template = element.FindResource("TrainBatchHis") as DataTemplate;
            }
            return template;
        }
    }
}
